/* DListNode.java */

package list;

/**
 *  A DListNode is a node in a DList (doubly-linked list).
 */

public class DListNode {

	/**
	 *  item references the item stored in the current node.
	 *  prev references the previous node in the DList.
	 *  next references the next node in the DList.
	 *  list references the list that this DListNode belongs to.
	 *
	 *  DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS.
	 */

	protected Object item;
	protected DListNode prev;
	protected DListNode next;
	protected DList list;

	/**
	 *  DListNode() constructor.
	 *  @param i the item to store in the node.
	 *  @param p the node previous to this node.
	 *  @param n the node following this node.
	 *  @param l the list that this node belongs to.
	 */
	DListNode(Object i, DListNode p, DListNode n, DList l) {
		item = i;
		prev = p;
		next = n;
		list = l;
	}

	/**
	 * item returns the item of "this" DListNode
	 * 
	 * @return is the item of this DListNode
	 */
	public Object item() {
		return item;
	}
}